/** State class ------------------------------------------------------**/
/** This classe is the base of any application's state
**/

#ifndef STATE_CLASS_H_
#define STATE_CLASS_H_

#include <vector>
#include <boost/shared_ptr.hpp>
#include "Context.h"

namespace BPL
{

class State;
typedef boost::shared_ptr<State> StatePtr;

class StateListener
{
public:
    StateListener(){};
    virtual ~StateListener(){};

	virtual void changeState(const StatePtr& state) = 0;
	virtual bool pushState(const StatePtr& state) = 0;
	virtual void popState() = 0;
	virtual void popAllStates() = 0;

	void setParent(Context* context)
	{
		mpt_parent = context;
	}

	Context* getParent()
	{
		return mpt_parent;
	}

protected:
	Context* mpt_parent;
};



class State
{
public:

	State(){}
    virtual ~State(){}
	virtual void enter() = 0;
    virtual void exit() = 0;
    virtual bool pause() = 0;
    virtual void resume() = 0;
    virtual void update(double time) = 0;

    void setParent(StateListener* parent)
    {
        mpt_parent = parent;
    }
    StateListener* getParent()
    {
        return mpt_parent;
    }

protected:
    StateListener* mpt_parent;

};
}

#endif
